/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 artifact_prop_spell_list.h

	$Header: /heroes4/artifact_prop_spell_list.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( ARTIFACT_PROP_SPELL_LIST_H_INCLUDED )
#define ARTIFACT_PROP_SPELL_LIST_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <set>
#include "artifact_prop_effect.h"

namespace t_artifact_prop
{
	// ----------------------------------------------------------------------
	// class for effects with multiple spell effects
	// ----------------------------------------------------------------------
	typedef std::set<t_spell> t_spell_set;

	class t_spell_list_effect : public t_artifact_effect
	{
	public:
		virtual bool	   accept( t_artifact_effect_visitor& visitor );
		void               add( t_spell spell );
		t_spell_set const& get_spells() const;
		bool			   has_spell( t_spell spell ) const;
		virtual bool	   read( std::streambuf& buffer );
		void               set_spells( t_spell_set const& spells );
		virtual bool	   write( std::streambuf& buffer ) const;
	protected:
		t_spell_set m_spells;
	};

	inline void t_spell_list_effect::add( t_spell spell )
	{
		m_spells.insert( spell );
	}

	inline t_spell_set const& t_spell_list_effect::get_spells() const
	{
		return m_spells;
	}

	inline bool t_spell_list_effect::has_spell( t_spell spell ) const
	{
		return m_spells.count(spell) > 0;
	}

	inline void t_spell_list_effect::set_spells( t_spell_set const& spells )
	{
		m_spells = spells;
	}

	typedef t_effect< t_spell_list_effect, k_artifact_effect_immunity >		t_immunity;
	typedef t_effect< t_spell_list_effect, k_artifact_effect_spell_book>	t_spell_book;
	typedef t_effect< t_spell_list_effect, k_artifact_effect_spell_bonus>	t_spell_bonus;

};

#endif // ARTIFACT_PROP_SPELL_LIST_H_INCLUDED